package cn.myschool.java79.test1;

import cn.myschool.java79.dao.ExamResultMapper;
import cn.myschool.java79.dao.GradeMapper;
import cn.myschool.java79.entity.ExamResult;
import cn.myschool.java79.entity.Grade;
import cn.myschool.java79.util.MybatisUtil;
import org.apache.ibatis.session.SqlSession;

/**
 * @author oldliu
 * @since 1.0
 */
public class GradeTest {
    public static void main(String[] args) {
        SqlSession s= MybatisUtil.get();

        try {
            GradeMapper mapper = s.getMapper(GradeMapper.class);
            Grade grade = mapper.get(5L);
            if(grade==null)
                return;
            System.out.println("年级信息："+grade);
            System.out.println("包含的课程：");
            grade.getSubjects().forEach(System.out::println);
        }finally {
            MybatisUtil.close(s);
        }

    }
}
